package view;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTextField;

import xl.Address;

import model.Sheet;

public class Editor extends JTextField implements ActionListener {
    private Sheet sheet;
    private CurrentView currentView;
	public Editor(Sheet sheet, CurrentView currentView) {
    	setText("");
        setBackground(Color.WHITE);
        addActionListener(this);
        this.sheet = sheet;
        this.currentView = currentView;
        
    }

    public void actionPerformed(ActionEvent event) {
    	sheet.put(new Address(currentView.getText()),this.getText());
    }
}